﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt;

    public class t_attachment_Map : ClassMapping<t_attachment>
    {
        public t_attachment_Map()
        {
            //映射ID
            Id(x => x.att_id, map => map.Length(40));

            Property(x => x.is_valid);
            Property(x => x.create_date);

            Property(x => x.att_bytes);
            Property(x => x.att_bytes, map => map.Length(500));
            Property(x => x.att_file_name_original, map => map.Length(500));
            Property(x => x.att_file_sufix, map => map.Length(500));

            //附件上传用户
            ManyToOne(x => x.att_upload_user, map =>
            {
                map.Column(t_attachment.Columns.att_upload_user_id);
                map.NotNullable(false);
            });

            Table(t_attachment.TableName);

            
            SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
